<template>

	<div id="evaluate-add-view">

		<van-nav-bar title="商品评价" left-text="返回" left-arrow @click-left="$router.go(-1)" />

		<div id="content" style="margin-top: 10px;">

			<van-cell>
				<van-field v-model="content" type="textarea" placeholder="请输入评价" rows="3" autosize />
			</van-cell>
			<van-cell>
				<van-rate v-model="rank" :color="CFG.colorPrimary" void-icon="star" void-color="#eee" />
			</van-cell>
			<van-cell>
				<van-button type="info" size="large" @click="evaluateAddSubmit()">提交评价</van-button>
			</van-cell>

		</div>
	</div>

</template>

<script>
	import {
		Toast
	} from 'vant';
	export default {


		data() {
			return {
				rank: 5,
				content: ''
			}
		},
		methods: {

			evaluateAddSubmit() {



        this.apiPost('/shop.order/evaluate_create', {
					order_goods_id: this.$route.query.id,
					content: this.content,
					rank: this.rank,
				}).then(res => {
          if (res.code == 0) {
          	Toast.success('谢谢您的评价')
          	this.$router.go(-1)
          	//eventBus.$emit('address_update_success', 'ok');
          	//this.backWhere();
          	// this.$router.push("/user/address");
          }else{
            Toast.fail(res.msg)
          }
        });


			}

		}



	}
</script>

<style>

</style>
